package com.example.jobback.websocket.mapper;

import com.example.jobback.websocket.dto.MessageSendDto;
import com.example.jobback.websocket.po.Message;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @InterfaceName: MessageMapper
 * @Description: 消息mapper
 * @Author: lhb
 * @Date: 2025/5/25
 */
@Mapper
public interface MessageMapper {
    List<Message> getMessagesByUserId(long userId, String role);

    void insertUserMessage(@Param("message")Message messageDataBase);

    void updateMessagesToOnline(@Param("userId") Long userId, @Param("role") String role);

    void clearUserMessageRecord(@Param("userId") Long userId, @Param("role") String role);

    /**
     * @Description: 批量更新消息已读状态
     * @param messageList
     * @return void
     * @Author lhb
     * @CreateTime 2025/9/20 22:25
     */
    void batchUpdateUnreadStatus(@Param("messageList") List<MessageSendDto> messageList);
}
